package com.wf.classRoomTest;

import com.wf.day_0531.test2.Person;

import java.text.Collator;
import java.util.*;

/**
 * @author mpk
 * @since 2024/6/3 14:08:05
 */
@TestB(name = "zzz")
@TestA(name = "yyy",value = {"xxx","xxx"})
public class A {
    public static void main(String[] args) {



        Collator collator = Collator.getInstance();
        Set<Person> people = new TreeSet<>((p1, p2) -> {
            int result = collator.compare(p1.getName(), p2.getName());
            if (result == 0) {
                result = Integer.compare(p1.getAge(), p2.getAge());
            }
            return result;
        });
        Collections.addAll(people,
                new Person("红",18),
                new Person("蓝",19),
                new Person("绿",20),
                new Person("紫",21),
                new Person("白",22),
                new Person("黄",23)
        );

        people.forEach(System.out::println);

        System.out.println(Collections.max(people, Comparator.comparing(Person::getAge)));


    }


}
